package com.haixiaoke.saas.lock.service.impl;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.lock.domain.HouseLock;
import com.haixiaoke.saas.lock.domain.LockPwd;
import com.haixiaoke.saas.lock.mapper.LockPwdMapper;
import com.haixiaoke.saas.lock.service.ILockPwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 锁密码信息Service业务层处理
 *
 * @author qixi
 * @date 2024-07-29
 */
@Service
public class LockPwdServiceImpl implements ILockPwdService {
    @Autowired
    private LockPwdMapper lockPwdMapper;

    /**
     * 查询锁密码信息
     *
     * @param pwdId 锁密码信息主键
     * @return 锁密码信息
     */
    @Override
    public LockPwd selectLockPwdByPwdId(Long pwdId) {
        return lockPwdMapper.selectLockPwdByPwdId(pwdId);
    }

    /**
     * 查询锁密码信息列表
     *
     * @param lockPwd 锁密码信息
     * @return 锁密码信息
     */
    @Override
    public List<LockPwd> selectLockPwdList(LockPwd lockPwd) {
        return lockPwdMapper.selectLockPwdList(lockPwd);
    }

    /**
     * 新增锁密码信息
     *
     * @param lockPwd 锁密码信息
     * @return 结果
     */
    @Override
    public int insertLockPwd(LockPwd lockPwd) {
        lockPwd.setCreateTime(DateUtils.getNowDate());
        return lockPwdMapper.insertLockPwd(lockPwd);
    }

    /**
     * 修改锁密码信息
     *
     * @param lockPwd 锁密码信息
     * @return 结果
     */
    @Override
    public int updateLockPwd(LockPwd lockPwd) {
        lockPwd.setUpdateTime(DateUtils.getNowDate());
        return lockPwdMapper.updateLockPwd(lockPwd);
    }

    /**
     * 批量删除锁密码信息
     *
     * @param pwdIds 需要删除的锁密码信息主键
     * @return 结果
     */
    @Override
    public int deleteLockPwdByPwdIds(Long[] pwdIds) {
        return lockPwdMapper.deleteLockPwdByPwdIds(pwdIds);
    }

    /**
     * 删除锁密码信息信息
     *
     * @param pwdId 锁密码信息主键
     * @return 结果
     */
    @Override
    public int deleteLockPwdByPwdId(Long pwdId) {
        return lockPwdMapper.deleteLockPwdByPwdId(pwdId);
    }

    @Override
    public int deleteLockPwdByLockId(Long lockId) {
        return lockPwdMapper.deleteLockPwdByLockId(lockId);
    }

    @Override
    public void lockFaceEffectiveStatusTask() {
        lockPwdMapper.lockFaceEffectiveStatusTask();
    }

    @Override
    public List<LockPwd> selectHousePwdList(HouseLock houseLock) {
        return lockPwdMapper.selectHousePwdList(houseLock);
    }

    @Override
    public List<LockPwd> selectLockPwdListAndHouseId(String houseId) {
        return lockPwdMapper.selectLockPwdListAndHouseId(houseId);
    }

    @Override
    public List<LockPwd> setLockPwdByLockIdAndPwdState(Long lockId, String pwdState) {
        return lockPwdMapper.setLockPwdByLockIdAndPwdState(lockId, pwdState);
    }

    @Override
    public int deleteLockPwdByOrderId(String orderId) {
        return lockPwdMapper.deleteLockPwdByOrderId(orderId);
    }
}
